﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Visa.DB;

namespace VisaApp.Models
{
    public class UserModel
    {
        public int UsID { get; set; }
        public string UserName { get; set; }
        public string UserPass { get; set; }
        public string UserFullName { get; set; }
        public string UserEmail { get; set; }
        public Nullable<System.DateTime> Birthday { get; set; }
        public Nullable<bool> Madel { get; set; }
        public string Phone { get; set; }
        public Nullable<bool> IsActive { get; set; }
        public Nullable<bool> IsEmail { get; set; }
        public Nullable<bool> Deleted { get; set; }
        public Nullable<System.DateTime> DateCreate { get; set; }
        public Nullable<System.DateTime> LastLogin { get; set; }

        public bool IsSystem { get; set; }

        public List<MoreInfoAdmin> ModelCheck { get; set; }

        // change Info
        public string PassNews { get; set; }
        public string PassNewsAgain { get; set; }
        public string EmailChange { get; set; }
        public string Emailchange2 { get; set; }
        public string Tendangnhapchange { get; set; }
        public string NameAddUser { get; set; }

        public static void MapFrom(UserModel model, ref User entity)
        {
            entity.UsID = model.UsID;
            entity.UserName = model.UserName;
            entity.UserEmail = model.UserEmail;
            entity.UserPass = model.UserPass;
            entity.UserFullName = model.UserFullName;
            entity.Birthday = model.Birthday;
            entity.Madel = model.Madel;
            entity.Phone = model.Phone;
            entity.IsActive = model.IsActive;
            entity.IsEmail = model.IsEmail;
            entity.Deleted = model.Deleted;
            entity.DateCreate = model.DateCreate;
            entity.LastLogin = model.LastLogin;
        }

        public static void MapForm(User entity, ref UserModel model)
        {
            model.UsID = entity.UsID;
            model.UserName = entity.UserName;
            model.UserEmail = entity.UserEmail;
            model.UserPass = entity.UserPass;
            model.UserFullName = entity.UserFullName;
            model.Birthday = entity.Birthday;
            model.Madel = entity.Madel;
            model.Phone = entity.Phone;
            model.IsActive = entity.IsActive;
            model.IsEmail = entity.IsEmail;
            model.Deleted = entity.Deleted;
            model.DateCreate = entity.DateCreate;
            model.LastLogin = entity.LastLogin;
        }

    }

    public class MoreInfoAdmin
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public bool Checkbox { get; set; }
    }
}